< previous page page_149 next page >

Page 149
Do While Not EOF(1)
 Process Statements
Loop
Do Until EOF(1)
 Process Statements
Loop
Both of these versions of the Do statement check the condition before entering the loop and then at the beginning of each iteration. As an example, in the Do Until statement, if the file was already at End of File, the code contained in the loop will not be processed. To confuse matters a little, both Do statements can be coded a different way. The syntax of this other method is as follows:
Do
[statements]
[Exit Do]
[statements]
Loop [{While ¦ Until} condition]
At first glance they might not look any different, but you should notice that the While or Until condition occurs at the bottom of the loop instead of at the top. This allows the code contained in the loop process to be executed at least once no matter what the state of the condition is.
Depending on the type of loop processing you must do, you must select the appropriate type of loop statement. For example, most file access routines that will loop reading records from the file usually use the Do Until method checking for the End of File condition to be True. Many times the type of loop you use is more for documentation purposes than for performance.
Summary
Today you learned how to work with objects and collections in your application. Accessing collections is no harder than working with arrays, although collection objects provide better performance and easier coding compared with array processing.
In addition, you learned several different ways to work with the multiple controls, with the focus on how to simplify the code you are writing. You have also seen how to create your own classes to package a process with its related data elements so that you can use them in any application. Finally, you had a short review of the different loop processing statements that you can use when working with collections and objects.

 
< previous page page_149 next page >

If you like this book, buy it!